package com.local.controller;

import com.local.mapper.UserMapper;
import com.local.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lou ke
 * @version 1.0
 * @date 2020/4/18 21:45
 */
@RestController
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @GetMapping("/queryUserList")
    public List<User> queryUserList() {
        List<User> users = userMapper.queryUserList();
        for (User user : users) {
            System.out.println(user);
        }
        return users;
    }

    @GetMapping("/addUser")
    public int addUser() {
        int cont = userMapper.addUser(new User(5, "lisi", "3435"));
        return cont;
    }

}
